<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    // 十进制转其他
    var num = 35;
    console.log(num.toString(2));
    console.log(num.toString(8));
    console.log(num.toString(10));
    console.log(num.toString(16));

    // 其他转十进制
    var str16 = "1a";
    var str8 = "13";
    var str2 = "11001";
    var str10 = "365"
    console.log(parseInt(str2, 2));
    console.log(parseInt(str8, 8));
    console.log(parseInt(str16, 16));
    console.log(parseInt(str10, 10));

    // 二进制转八进制
    // 其他转其他，先以十进制过渡
    var str = "11011101"
    console.log(parseInt(str, 2).toString(8));

</script>
</html>